package bdd.standalone.bean;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Bean QoSPlaning.
 * @author Guillaume Pocas & Jean-Fraçois Augé
 */
@Entity
@Table(name = "qos_planning")
public class QoSPlanning {
	
	@Id
	@GeneratedValue
	@Column(name = "qosplan_id")
	private int qosplan_id;
	
	@ManyToMany(cascade = {CascadeType.ALL})
    @JoinTable(name="qos_qosplan",
                joinColumns={@JoinColumn(name="qos_id")},
                inverseJoinColumns={@JoinColumn(name="qosplan_id")})
    private Set<QoS> list_qos = new HashSet<QoS>();
	
	@Column(name = "qosplan_timeBegin", nullable = false)
	private Date qosplan_timeBegin;
	
	@Column(name = "qosplan_timeEnd", nullable = false)
	private Date qosplan_timeEnd;
	
	@Column(name = "qosplan_dayBegin", nullable = false)
	private Date qosplan_dayBegin;
	
	@Column(name = "qosplan_dayEnd", nullable = false)
	private Date qosplan_dayEnd;
	
	@OneToMany(mappedBy="qosPlanning")
    private Set<Planning> plannings;
	
	/**
	 * Constructeur vide.
	 */
	public QoSPlanning(){ }
	
	/**
	 * Créer un nouveau QoSPlaning.
	 * @param timeBegin
	 * @param timeEnd
	 * @param dayBegin
	 * @param dayEnd
	 */
	public QoSPlanning(Date timeBegin, Date timeEnd, Date dayBegin, Date dayEnd){
		this.qosplan_timeBegin = timeBegin;
		this.qosplan_timeEnd = timeEnd;
		this.qosplan_dayBegin = dayBegin;
		this.qosplan_dayEnd = dayEnd;
	}

	public int getQosplan_id() { return qosplan_id;	}
	public void setQosplan_id(int qosplan_id) { this.qosplan_id = qosplan_id;	}

	public Set<QoS> getList_qos() { return list_qos;	}
	public void setList_qos(Set<QoS> list_qos) { this.list_qos = list_qos;	}

	public Date getQosplan_timeBegin() { return qosplan_timeBegin;	}
	public void setQosplan_timeBegin(Date qosplan_timeBegin) { this.qosplan_timeBegin = qosplan_timeBegin;	}

	public Date getQosplan_timeEnd() { return qosplan_timeEnd;	}
	public void setQosplan_timeEnd(Date qosplan_timeEnd) { this.qosplan_timeEnd = qosplan_timeEnd;	}

	public Date getQosplan_dayBegin() { return qosplan_dayBegin;	}
	public void setQosplan_dayBegin(Date qosplan_dayBegin) { this.qosplan_dayBegin = qosplan_dayBegin;	}

	public Date getQosplan_dayEnd() { return qosplan_dayEnd;	}
	public void setQosplan_dayEnd(Date qosplan_dayEnd) { this.qosplan_dayEnd = qosplan_dayEnd;	}

	public Set<Planning> getPlannings() { return plannings;	}
	public void setPlannings(Set<Planning> plannings) { this.plannings = plannings;	}

}